package com.wkhyapp.lm.adapter;

import android.content.Context;
import android.graphics.Color;
import android.widget.ImageView;
import android.widget.TextView;

import com.wkhyapp.lm.R;
import com.wkhyapp.lm.adapter.base.HolderEntity;
import com.wkhyapp.lm.adapter.base.MirAdapter;
import com.wkhyapp.lm.http.vo.Member;
import com.wkhyapp.lm.utils.ImageLoadUtil;

import java.util.List;

/**
 * Created by fang on 2021/10/9.
 */

public class HostAdapter extends MirAdapter<Member> {


    public HostAdapter(Context context, List<Member> mDatas, int itemLayoutId) {
        super(context, mDatas, itemLayoutId);
    }

    @Override
    public void convert(HolderEntity helper, Member item) {
        ImageView head = helper.getView(R.id.head_iv);
        helper.setText(R.id.number_tv,(helper.getPosition()+1)+"");

        TextView number_tv = helper.getView(R.id.number_tv);
        if(helper.getPosition()==0){
            number_tv.setTextColor(Color.parseColor("#FF4081"));
        }else if(helper.getPosition()==1){
            number_tv.setTextColor(Color.parseColor("#90FF4081"));
        }else if(helper.getPosition()==2){
            number_tv.setTextColor(Color.parseColor("#80FF4081"));
        }
        else if(helper.getPosition()==3){
            number_tv.setTextColor(Color.parseColor("#70FF4081"));
        }else{
            number_tv.setTextColor(Color.parseColor("#999999"));
        }

        if(item.getHeadImg().startsWith("http")){
            ImageLoadUtil.setCirlcleImage_Normal(mContext,item.getHeadImg(),50,head);
        }else{
            ImageLoadUtil.setCirlcleImage_Normal(mContext,"https://a.wkhyapp.com"+item.getHeadImg(),50,head);
        }


        helper.setText(R.id.name_tv,item.getNickname());
        helper.setText(R.id.remk_tv,item.getRemark());
    }


}
